//
//  GoldenVPNOrderCell.m
//  QLadder
//
//  Created by xiongguobing on 2019/8/19.
//  Copyright © 2019 qding. All rights reserved.
//

#import "GoldenVPNOrderCell.h"
#import "OrderListModel.h"

@interface GoldenVPNOrderCell ()

@property (weak, nonatomic) IBOutlet UIImageView *typeImgView;
@property (weak, nonatomic) IBOutlet UILabel *orderNoLabel;
@property (weak, nonatomic) IBOutlet UILabel *serviceLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabem;
@property (weak, nonatomic) IBOutlet UIButton *payButton;


@end

@implementation GoldenVPNOrderCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setModel:(OrderListModel *)model
{
    _model = model;
    self.typeImgView.image = [model.payType isEqualToString:@"wxpay"] ? [UIImage imageNamed:@"wechat"] : [UIImage imageNamed:@"zhifubao"];
    self.orderNoLabel.text = [NSString stringWithFormat:@"订单号：%@", model.orderNo];
    self.serviceLabel.text = [NSString stringWithFormat:@"套餐：%@    金额：%@元", ValidStr(model.productName) ? model.productName : @"-", model.money];
    self.timeLabem.text = [NSString stringWithFormat:@"订单时间：%@", model.createTime ? : @""];
    if ([model.flag isEqualToString:@"支付成功"]) {
        self.payButton.hidden = YES;
        self.typeImgView.hidden = NO;
    }else{
        self.payButton.hidden = NO;
        self.typeImgView.hidden = YES;
    }
}

- (IBAction)payButtonClicked:(id)sender
{
    if (!self.model.orderNo.length) {
        return;
    }
    if (self.payBlock) {
        self.payBlock();
    }
}

- (void)handlePayButtonClickedBlock:(payButtonClickedBlock)payBlock
{
    self.payBlock = payBlock;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
